//
//  CTabView.h
//  etionUI
//
//  Created by wangjian on 8/15/13.
//
//

#import <UIKit/UIKit.h>

@interface CTabItem : NSObject

@property (nonatomic, copy) NSString *title;
@property (nonatomic, retain) UIView *headView;

+ (CTabItem *)tabItemWithTitle:(NSString *)title;
+ (CTabItem *)tabItemWithTitle:(NSString *)title headView:(UIView *)headView;

@end

@class CTabView;
@protocol CTabViewDelegate <UIScrollViewDelegate>

- (void)tabView:(CTabView *)tabView willSelectItemAtIndex:(NSUInteger)index;
- (void)tabView:(CTabView *)tabView didSelectItemAtIndex:(NSUInteger)index;

@end

@interface CTabView : UIView <UIScrollViewDelegate>

@property (nonatomic, assign) id<CTabViewDelegate> delegate;

@property (nonatomic, retain) UIColor *titleColor;          //default is black
@property (nonatomic, retain) UIColor *selectedTitleColor;  //default is white
@property (nonatomic, retain) UIImageView *backgroundView;
@property (nonatomic, retain) UIImageView *selectedBackgroundView;
@property (nonatomic, assign) NSUInteger curSelectedIndex;
@property (nonatomic, readonly) NSUInteger itemNum;

//- (id)initWithFrame:(CGRect)frame;
- (void)setTabItems:(NSArray *)items;
- (void)setTabItem:(CTabItem *)item atIndex:(NSUInteger)index animated:(BOOL)animated;

- (void)moveToIndex:(NSUInteger)index;
- (void)moveToPositionRate:(CGFloat)rate;

- (void)disableItemFromIndex:(NSUInteger)index; //用于设置不能点击的项，从index开始，如果index>item count则所有项均能点击

@end
